<?php
Class Md_common extends CI_Model{
	function insert($table,$data){
		$this->db->insert($table,$data);
		return $this->db->insert_id();
	}
	function update($table,$data,$where){
		foreach ($where as  $key => $value){
			$this->db->where($key,$value);
		}
		
		$this->db->update($table,$data);
	}
	function select($table){
		$query= $this->db->get($table);
		return $query->result();
	}
	/*
	 * $table : ten table
	 * $field : ten field
	 * $arra  : mang data
	 */
	function select_where_in($table,$field,$arr){
			$this->db->where_in($field,$arr);
			
			$query = $this->db->get("aodai");
			return $query->result();
		}
	function query($query){
		$query= $this->db->query($query);
		return $query->result();
	}
	function delete_query($query){
		$query= $this->db->query($query);
	}
	function delete($table,$where){
		foreach ($where as  $key => $value){
			$this->db->where($key,$value);
		}
		$this->db->delete($table);
	}
}
?>